package com.softeem.swaggerdemo.controller.user;

import com.softeem.swaggerdemo.entity.User;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletRequest;

/**
 * @Author mrchai 2020/10/12 14:16
 */
@Api(value = "用户模块",description = "用户模块相关功能，包含注册，登录，授权，账户管理，密码修改等功能")
@RequestMapping("/user")
@RestController
public class UserController {

    @ApiOperation(value = "用户注册",notes = "根据提供的用户信息完成用户注册功能呢")
    @PostMapping("/reg")
    public String reg(String name,String passwod){
        System.out.println("用户注册");
        return "reg";
    }

    @ApiOperation(value = "用户信息更新",notes = "提供包含了用户id的最新用户信息")
    @PutMapping("/modify")
    public String modify(User user){
        System.out.println("修改用户信息");
        return "modify";
    }

    @ApiOperation(value = "用户登录",notes = "根据传入的账号密码信息实现等功")
    @GetMapping("/login")
    public User login(String username,String password){
        System.out.println("用户登录");
        return new User(1001,"softeem","DAHAKS766ASD89989SDSVSDF");
    }


    @ApiOperation(value = "用户删除",notes = "根据提供的用户id删除用户")
    @DeleteMapping("/del/{uid}")
    public String delete(@PathVariable int uid){
        System.out.println("删除用户--->"+uid);
        return "delete";
    }

}
